import Header from '../layouts/Header.vue';
import Books from '../pages/Books.vue';
import Users from '../pages/Users.vue';
import Tables from '../pages/Tables.vue';
import CreateUser from '../pages/CreateUser.vue';
import CreateBook from '../pages/CreateBook.vue';
import CreateLoan from '../pages/CreateLoan.vue';
import Loans from '../pages/Loans.vue';
import Login from '../pages/Login.vue';

const routes = [
    {
        path:"/login",
        name:"login",
        component: Login,
    },
    {
        path:"/admin",
        name:"admin",
        component:Header,
        children:[
            {
                path: "tables",
                children: [
                    {
                        path: "",
                        name: "tables",
                        component: Tables,
                    },
                ]
            },
            {
                path: "books",
                children: [
                    {
                        path: "",
                        name: "books",
                        component: Books,
                    },
                    {
                        path: "create",
                        name: "create_book",
                        component: CreateBook,
                    },
                ]
            },
            {
                path: "/users",
                children: [
                    {
                        path: "",
                        name: "users",
                        component: Users,
                    },
                    {
                        path: "create",
                        name: "create_user",
                        component: CreateUser,
                    },
                ]
            },
            {
                path: "loans",
                children: [
                    {
                        path: "",
                        name: "loans",
                        component: Loans,
                    },
                    {
                        path: "create",
                        name: "create_loan",
                        component: CreateLoan,
                    },
                ]
            },
        ]
    },
    {
        path: "/:catchAll(.*)",
        hidden: true,
        component: Login
    }
];

export default routes;